<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QWebPluginFactory Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QWebPluginFactory Class Reference<br /><sup><sup>[<a href="qtwebkit.html">QtWebKit</a> module]</sup></sup></h1><p>The QWebPluginFactory class is used to embed custom data types
in web pages. <a href="#details">More...</a></p>

<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qwebpluginfactory.html#Extension-enum">Extension</a></b> {  }</li><li><div class="fn" />class <b><a href="qwebpluginfactory-extensionoption.html">ExtensionOption</a></b></li><li><div class="fn" />class <b><a href="qwebpluginfactory-extensionreturn.html">ExtensionReturn</a></b></li><li><div class="fn" />class <b><a href="qwebpluginfactory-mimetype.html">MimeType</a></b></li><li><div class="fn" />class <b><a href="qwebpluginfactory-plugin.html">Plugin</a></b></li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qwebpluginfactory.html#QWebPluginFactory">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />QObject <b><a href="qwebpluginfactory.html#create">create</a></b> (<i>self</i>, QString&#160;<i>mimeType</i>, QUrl&#160;<i>url</i>, QStringList&#160;<i>argumentNames</i>, QStringList&#160;<i>argumentValues</i>)</li><li><div class="fn" />bool <b><a href="qwebpluginfactory.html#extension">extension</a></b> (<i>self</i>, Extension&#160;<i>extension</i>, ExtensionOption&#160;<i>option</i>&#160;=&#160;None, ExtensionReturn&#160;<i>output</i>&#160;=&#160;None)</li><li><div class="fn" />list-of-QWebPluginFactory.Plugin <b><a href="qwebpluginfactory.html#plugins">plugins</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwebpluginfactory.html#refreshPlugins">refreshPlugins</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qwebpluginfactory.html#supportsExtension">supportsExtension</a></b> (<i>self</i>, Extension&#160;<i>extension</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QWebPluginFactory class is used to embed custom data types
in web pages.</p>
<p>The HTML <tt>&lt;object&gt;</tt> tag is used to embed arbitrary
content into a web page, for example:</p>
<pre class="cpp">
 <span class="operator">&lt;</span>object type<span class="operator">=</span><span class="string">"application/x-pdf"</span> data<span class="operator">=</span><span class="string">"http://qt.nokia.com/document.pdf"</span> width<span class="operator">=</span><span class="string">"500"</span> height<span class="operator">=</span><span class="string">"400"</span><span class="operator">&gt;</span><span class="operator">&lt;</span><span class="operator">/</span>object<span class="operator">&gt;</span>
</pre>
<p>QtWebkit will natively handle the most basic data types like
<tt>text/html</tt> and <tt>image/jpeg</tt>, but for any advanced or
custom data types you will need to provide a handler yourself.</p>
<p>QWebPluginFactory is a factory for creating plugins for <a href="qwebpage.html">QWebPage</a>, where each plugin provides support
for one or more data types. A plugin factory can be installed on a
<a href="qwebpage.html">QWebPage</a> using <a href="qwebpage.html#setPluginFactory">QWebPage.setPluginFactory</a>().</p>
<p><b>Note:</b> The plugin factory is only used if plugins are
enabled through <a href="qwebsettings.html">QWebSettings</a>.</p>
<p>You provide a QWebPluginFactory by implementing the <a href="qwebpluginfactory.html#plugins">plugins</a>() and the <a href="qwebpluginfactory.html#create">create</a>() methods. For <a href="qwebpluginfactory.html#plugins">plugins</a>() it is necessary to
describe the plugins the factory can create, including a
description and the supported MIME types. The MIME types each
plugin can handle should match the ones specified in in the HTML
<tt>&lt;object&gt;</tt> tag of your content.</p>
<p>The <a href="qwebpluginfactory.html#create">create</a>() method
is called if the requested MIME type is supported. The
implementation has to return a new instance of the plugin requested
for the given MIME type and the specified URL.</p>
<p>The plugins themselves are subclasses of <a href="qobject.html">QObject</a>, but currently only plugins based on
either <a href="qwidget.html">QWidget</a> or <a href="qgraphicswidget.html">QGraphicsWidget</a> are supported.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Extension-enum" />QWebPluginFactory.Extension</h3><hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QWebPluginFactory" />QWebPluginFactory.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qwebpluginfactory.html">QWebPluginFactory</a> with parent
<i>parent</i>.</p>


<h3 class="fn"><a name="create" /><a href="qobject.html">QObject</a> QWebPluginFactory.create (<i>self</i>, QString&#160;<i>mimeType</i>, <a href="qurl.html">QUrl</a>&#160;<i>url</i>, QStringList&#160;<i>argumentNames</i>, QStringList&#160;<i>argumentValues</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Implemented in subclasses to create a new plugin that can
display content of the MIME type given by <i>mimeType</i>. The URL
of the content is provided in <i>url</i>. The returned object
should be a <a href="qwidget.html">QWidget</a>.</p>
<p>The HTML object element can provide parameters through the
<tt>&lt;param&gt;</tt> tag. The name and the value attributes of
these tags are specified by the <i>argumentNames</i> and
<i>argumentValues</i> string lists.</p>
<p>For example:</p>
<pre class="cpp">
 <span class="operator">&lt;</span>object type<span class="operator">=</span><span class="string">"application/x-pdf"</span> data<span class="operator">=</span><span class="string">"http://qt.nokia.com/document.pdf"</span> width<span class="operator">=</span><span class="string">"500"</span> height<span class="operator">=</span><span class="string">"400"</span><span class="operator">&gt;</span>
     <span class="operator">&lt;</span>param name<span class="operator">=</span><span class="string">"showTableOfContents"</span> value<span class="operator">=</span><span class="string">"true"</span> <span class="operator">/</span><span class="operator">&gt;</span>
     <span class="operator">&lt;</span>param name<span class="operator">=</span><span class="string">"hideThumbnails"</span> value<span class="operator">=</span><span class="string">"false"</span> <span class="operator">/</span><span class="operator">&gt;</span>
 <span class="operator">&lt;</span><span class="operator">/</span>object<span class="operator">&gt;</span>
</pre>
<p>The above object element will result in a call to create() with
the following arguments:</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th>Parameter</th>
<th>Value</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td>mimeType</td>
<td>"application/x-pdf"</td>
</tr>
<tr class="even" valign="top">
<td>url</td>
<td>"http://qt.nokia.com/document.pdf"</td>
</tr>
<tr class="odd" valign="top">
<td>argumentNames</td>
<td>"showTableOfContents" "hideThumbnails"</td>
</tr>
<tr class="even" valign="top">
<td>argumentVaues</td>
<td>"true" "false"</td>
</tr>
</table>
<p><b>Note:</b> Ownership of the returned object will be
transferred to the caller.</p>


<h3 class="fn"><a name="extension" />bool QWebPluginFactory.extension (<i>self</i>, <a href="qwebpluginfactory.html#Extension-enum">Extension</a>&#160;<i>extension</i>, <a href="qwebpluginfactory-extensionoption.html">ExtensionOption</a>&#160;<i>option</i>&#160;=&#160;None, <a href="qwebpluginfactory-extensionreturn.html">ExtensionReturn</a>&#160;<i>output</i>&#160;=&#160;None)</h3><h3 class="fn"><a name="plugins" />list-of-QWebPluginFactory.Plugin QWebPluginFactory.plugins (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>This function is reimplemented in subclasses to return a list of
supported plugins the factory can create.</p>
<p><b>Note:</b> Currently, this function is only called when
JavaScript programs access the global <tt>plugins</tt> or
<tt>mimetypes</tt> objects.</p>


<h3 class="fn"><a name="refreshPlugins" />QWebPluginFactory.refreshPlugins (<i>self</i>)</h3><p>This function is called to refresh the list of supported
plugins. It may be called after a new plugin has been installed in
the system.</p>
<h3 class="fn"><a name="supportsExtension" />bool QWebPluginFactory.supportsExtension (<i>self</i>, <a href="qwebpluginfactory.html#Extension-enum">Extension</a>&#160;<i>extension</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>